my_foods = ['pizza', 'falafei', 'carrot cake']
firend_foods = my_foods[:]

my_foods.append('cannoli')
#my_foods.append('banana')
firend_foods.append('ice cream')
firend_foods.append('apple')

print("My favorite foods are:")
print(my_foods)
print(type(my_foods))
print(id(my_foods))
print('^^^^^^^^^^^^^')
for food in my_foods:
    print(food)
print('^^^^^^^^^^^^^')

print("firend_foods favorite foods are:")
print(firend_foods)
print(type(firend_foods))
print(id(firend_foods))
print('^^^^^^^^^^^^^')
for food in firend_foods:
    print(food)
print('^^^^^^^^^^^^^')
# list 最开始三个元素
print("The first three items in the list are:")
print(my_foods[:3])
print("The first three items in the list are:")
print(firend_foods[:3])
print('************************')
# list 中间三个元素
print(my_foods)
a = len(my_foods)
print(a)
b = a // 2
print(b)
print('The middle items in the list are:')
'''
if b < (a/2):
    print(my_foods[b-1:b+2])
elif b == (a/2):
    print(my_foods[b-1:b+2])
'''
print(my_foods[b-1:b+2])
# list 最后三个元素
print("The last three items in the list are:")
print(my_foods[-3:])
print(firend_foods[-3:])


my_pizzas = ['pizza', 'falafei', 'carrot cake']
firend_pizzas = my_pizzas[:]

my_pizzas.append('KFC')
firend_pizzas.append('M')

print("My favorite pizzas are:")
for pizza in my_pizzas:
    print(pizza)

print("firend favorite pizzas are:")
for pizza in firend_pizzas:
    print(pizza)
